package Utilidades;

import CDB.PersonFactory;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

/**
 *
 * @author lightemp
 */
public class RevisaConexion {

    private Session session;
    private SessionFactory sessionFactory;

    public boolean existeConexion() {
        boolean conexion = true;
        try {
            session = null;
            sessionFactory = PersonFactory.getSessionFactory();
            session = sessionFactory.openSession();

            //Creacion de query para obtener todos los empleados
            session.createQuery("from Employee e").list();
        } catch (Exception e) {
            return false;
        } finally {
        }
        return conexion;
    }
}
